package dto

import (
	"github.com/gin-gonic/gin"
	"tino_manager/public"
)

type AddMenuInput struct {
	PageKey  string `json:"page_key" form:"page_key" comment:"所属页面" validate:"required"`
	MenuName string `json:"menu_name" form:"menu_name" comment:"菜单名称" validate:"required"`
	MenuPath string `json:"menu_path" form:"menu_path" comment:"菜单路径" validate:"required"`
	Icon     string `json:"icon" form:"icon" comment:"图标" validate:"required"`
}

func (params *AddMenuInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type MenuPageInput struct {
	PageSize   int `json:"page_size" form:"page_size" comment:"每页数量" validate:"required,lte=20"`
	PageNumber int `json:"page_number" form:"page_number" comment:"页码" validate:"required"`
}

func (params *MenuPageInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type MenuInfo struct {
	Id       string `json:"id"`
	PageKey  string `json:"page_key"`
	MenuName string `json:"menu_name"`
	MenuPath string `json:"menu_path"`
	Icon     string `json:"icon"`
	Status   uint8  `json:"status"`
}
type MenuPageOutput struct {
	List  []MenuInfo `json:"list"`
	Total int64      `json:"total"`
}

type UpdateMenuInput struct {
	Id       string `json:"id"`
	PageKey  string `json:"page_key" form:"page_key" comment:"所属页面" validate:"required"`
	MenuName string `json:"menu_name" form:"menu_name" comment:"菜单名称" validate:"required"`
	MenuPath string `json:"menu_path" form:"menu_path" comment:"菜单路径" validate:"required"`
	Icon     string `json:"icon" form:"icon" comment:"图标" validate:"required"`
	Status   uint8  `json:"status" form:"status" comment:"状态"`
}

func (params *UpdateMenuInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type MenuDetailInput struct {
	Id string `json:"id" form:"id" comment:"菜单id" validate:"required"`
}

func (params *MenuDetailInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type MenuRemoveInput struct {
	Id string `json:"id" form:"id" comment:"菜单id" validate:"required"`
}

func (params *MenuRemoveInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}
